<template>
  <div id="wait">
    <div class="box">
      <img
        src="https://tsyx-rights-and-interests.oss-cn-hangzhou.aliyuncs.com/img/wait.png"
        alt=""
        class="waitImg"
      />
      <p>认证中…</p>
      <h4>大约需要30分钟</h4>
      <div class="backIndex" @click="backIndexButton">返回首页</div>
    </div>
  </div>
</template>

<script>
import req from "@/utils/index";
export default {
  data() {
    return {
      timer: null,
    };
  },
  methods: {
    backIndexButton() {
      clearInterval(this.timer);
      this.$router.push({name: 'index'});
    },
  },
  created() {
    this.timer = setInterval(function () {
      req("get", `/qy/user/info`, {}).then((res) => {
        if (res.rspCode == "000000") {
          window.localStorage.setItem("userMsg", JSON.stringify(res.data));
          if (res.data.userType == 2) {
              clearInterval(this.timer)
            this.$router.push({name: 'authenticationOk'});
          }
        }
      });
    }, 1000);
  },
};
</script>

<style lang='scss' scoped>
#wait {
  text-align: center;
}
.box {
  position: relative;
  top: 2.5rem;

  .waitImg {
    width: 50%;
  }
  p,
  h4 {
    font-weight: 400;
  }
  p {
    font-size: 0.4rem;
  }
  h4 {
    font-size: 0.65rem;
  }
}
.backIndex {
  display: inline-block;
  margin-top: 3rem;
  padding: 0.3rem 2rem;
  border: 1px solid #c41e34;
  color: #c41e34;
  border-radius: 0.5rem;
  //   color: steelblue;
}
</style>